package cn.zn.modules.appoin.controller;

import cn.zn.framework.common.utils.R;
import cn.zn.modules.appoin.entity.AppoinTimeRuleEntity;
import cn.zn.modules.appoin.entity.AtRule;
import cn.zn.modules.appoin.service.AppoinTimeRuleService;
import cn.zn.modules.appoin.service.AtRuleService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * 规则：个人
 */
@RestController
@RequestMapping("appoin/atrule")
public class AtRuleController {

    @Autowired
    private AtRuleService atRuleService;
    @Autowired
    private AppoinTimeRuleService appoinTimeRuleService;

    /**
     * 工作人员列表
     *
     * @param params
     * @return
     */
    @PostMapping("workUserList")
    public R workUserList(@RequestParam Map<String, Object> params) {
        return R.ok().put("list", atRuleService.workerList(params));
    }

    /**
     * 详情
     */
    @GetMapping("/info/{userCode}")
    public R info(@PathVariable("userCode") String userCode) {
        return R.ok().put("atrule", atRuleService.queryRuleByUserCode(userCode));
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody AtRule atRule) {
        atRuleService.updateById(atRule);

        return R.ok();
    }
}
